/*
 * XML Type:  XGridBody
 * Namespace: http://www.seedwill.com/xul/core
 * Java type: com.seedwill.xul.core.XGridBody
 *
 * Automatically generated - do not modify.
 */
package com.seedwill.xul.core.impl;
/**
 * An XML XGridBody(@http://www.seedwill.com/xul/core).
 *
 * This is a complex type.
 */
public class XGridBodyImpl extends com.seedwill.xul.core.impl.XIdentifiedImpl implements com.seedwill.xul.core.XGridBody
{
    private static final long serialVersionUID = 1L;
    
    public XGridBodyImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }
    
    private static final javax.xml.namespace.QName ROWS$0 = 
        new javax.xml.namespace.QName("", "rows");
    
    
    /**
     * Gets array of all "rows" elements
     */
    public com.seedwill.xul.core.XRow[] getRowsArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(ROWS$0, targetList);
            com.seedwill.xul.core.XRow[] result = new com.seedwill.xul.core.XRow[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }
    
    /**
     * Gets ith "rows" element
     */
    public com.seedwill.xul.core.XRow getRowsArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.core.XRow target = null;
            target = (com.seedwill.xul.core.XRow)get_store().find_element_user(ROWS$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }
    
    /**
     * Returns number of "rows" element
     */
    public int sizeOfRowsArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(ROWS$0);
        }
    }
    
    /**
     * Sets array of all "rows" element
     */
    public void setRowsArray(com.seedwill.xul.core.XRow[] rowsArray)
    {
        synchronized (monitor())
        {
            check_orphaned();
            arraySetterHelper(rowsArray, ROWS$0);
        }
    }
    
    /**
     * Sets ith "rows" element
     */
    public void setRowsArray(int i, com.seedwill.xul.core.XRow rows)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.core.XRow target = null;
            target = (com.seedwill.xul.core.XRow)get_store().find_element_user(ROWS$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(rows);
        }
    }
    
    /**
     * Inserts and returns a new empty value (as xml) as the ith "rows" element
     */
    public com.seedwill.xul.core.XRow insertNewRows(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.core.XRow target = null;
            target = (com.seedwill.xul.core.XRow)get_store().insert_element_user(ROWS$0, i);
            return target;
        }
    }
    
    /**
     * Appends and returns a new empty value (as xml) as the last "rows" element
     */
    public com.seedwill.xul.core.XRow addNewRows()
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.seedwill.xul.core.XRow target = null;
            target = (com.seedwill.xul.core.XRow)get_store().add_element_user(ROWS$0);
            return target;
        }
    }
    
    /**
     * Removes the ith "rows" element
     */
    public void removeRows(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(ROWS$0, i);
        }
    }
}
